#include <board.h>
#include <board_memories.h>
#include <lcd/lcdd.h>
#include <lcd/draw.h>

static unsigned char *_lcd_buffer = (unsigned char *) (AT91C_EBI_SDRAM + 0x01000000);

int main() {

    // Initialize LCD
    LCDD_Fill(_lcd_buffer, COLOR_WHITE);
    LCDD_Initialize();
    LCDD_DisplayBuffer(_lcd_buffer);

#if !defined(sdram)
    BOARD_ConfigureSdram(BOARD_SDRAM_BUSWIDTH);
#endif

    // Gay Proud
    LCDD_DrawRectangle(_lcd_buffer, 13 + 42*0, 0, 42, BOARD_LCD_HEIGHT, COLOR_RED);
    LCDD_DrawRectangle(_lcd_buffer, 13 + 42*1, 0, 42, BOARD_LCD_HEIGHT, COLOR_ORANGE);
    LCDD_DrawRectangle(_lcd_buffer, 13 + 42*2, 0, 42, BOARD_LCD_HEIGHT, COLOR_YELLOW);
    LCDD_DrawRectangle(_lcd_buffer, 13 + 42*3, 0, 42, BOARD_LCD_HEIGHT, COLOR_GREEN);
    LCDD_DrawRectangle(_lcd_buffer, 13 + 42*4, 0, 42, BOARD_LCD_HEIGHT, COLOR_BLUE);
    LCDD_DrawRectangle(_lcd_buffer, 13 + 42*5, 0, 42, BOARD_LCD_HEIGHT, COLOR_INDIGO);
    LCDD_DrawRectangle(_lcd_buffer, 13 + 42*6, 0, 42, BOARD_LCD_HEIGHT, COLOR_VIOLET);

    // Macho Man
    LCDD_DrawCircle(_lcd_buffer, 70, 50, 42, COLOR_OLIVE);

    LCDD_DrawHorizontalLine(_lcd_buffer, 0, 50, BOARD_LCD_WIDTH, COLOR_SIENNA);
    LCDD_DrawVerticalLine(_lcd_buffer, 70, 0, BOARD_LCD_HEIGHT, COLOR_SIENNA);

    LCDD_DrawTriangle(_lcd_buffer, 300, 150, 100, 70, 30, 200, COLOR_AZUR);

    LCDD_DrawString(_lcd_buffer, 20, BOARD_LCD_HEIGHT - 25, "the cake is a lie", COLOR_SKYBLUE);

    return 0;
}
